home *** CD-ROM | disk | FTP | other *** search
- /* GadTools layout toolkit
- **
- ** Copyright © 1993-1994 by Olaf `Olsen' Barthel
- ** Freely distributable.
- */
-
- #include "gtlayout_global.h"
-
- BOOL
- LT_Init()
- {
- if(SysBase)
- return(TRUE);
- else
- {
- SysBase = *(struct ExecBase **)4;
-
- if(SysBase -> LibNode . lib_Version < 37)
- {
- SysBase = NULL;
-
- return(FALSE);
- }
- else
- {
- V39 = (SysBase -> LibNode . lib_Version >= 39);
- V40 = (SysBase -> LibNode . lib_Version >= 40);
-
- IntuitionBase = OpenLibrary("intuition.library",37);
- GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",37);
- UtilityBase = OpenLibrary("utility.library",37);
- GadToolsBase = OpenLibrary("gadtools.library",37);
- KeymapBase = OpenLibrary("keymap.library",37);
-
- if(LocaleBase = (struct LocaleBase *)OpenLibrary("locale.library",38))
- LTP_Locale = OpenLocale(NULL);
-
- if(IntuitionBase && GfxBase && UtilityBase && GadToolsBase && KeymapBase)
- {
- if(LTP_ImageClass = MakeClass(NULL,IMAGECLASS,NULL,sizeof(ImageInfo),0))
- {
- LTP_ImageClass -> cl_Dispatcher . h_Entry = (HOOKFUNC)LTP_ImageDispatch;
-
- #ifdef DO_LEVEL_KIND
- if(LTP_LevelClass = MakeClass(NULL,IMAGECLASS,NULL,sizeof(LevelImageInfo),0))
- {
- LTP_LevelClass -> cl_Dispatcher . h_Entry = (HOOKFUNC)LTP_LevelClassDispatcher;
- #else
- {
- #endif /* DO_LEVEL_KIND */
- #ifdef DO_PICKSHORTCUTS
- InitSemaphore(<P_KeySemaphore);
- #endif /* DO_PICKSHORTCUTS */
- InitSemaphore(<P_LockSemaphore);
-
- NewList(<P_LockList);
-
- return(TRUE);
- }
- }
- }
-
- LT_Exit();
-
- return(FALSE);
- }
- }
- }
-
-
- /*****************************************************************************/
-
-
- VOID
- LT_Exit()
- {
- if(SysBase)
- {
- #ifdef DO_LEVEL_KIND
- if(LTP_LevelClass)
- {
- FreeClass(LTP_LevelClass);
-
- LTP_LevelClass = NULL;
- }
- #endif /* DO_LEVEL_KIND */
- if(LTP_ImageClass)
- {
- FreeClass(LTP_ImageClass);
-
- LTP_ImageClass = NULL;
- }
-
- if(LTP_Locale)
- {
- CloseLocale(LTP_Locale);
-
- LTP_Locale = NULL;
- }
-
- CloseLibrary(LocaleBase);
-
- LocaleBase = NULL;
-
- CloseLibrary(KeymapBase);
-
- KeymapBase = NULL;
-
- CloseLibrary(GadToolsBase);
-
- GadToolsBase = NULL;
-
- CloseLibrary(UtilityBase);
-
- UtilityBase = NULL;
-
- CloseLibrary(GfxBase);
-
- GfxBase = NULL;
-
- CloseLibrary(IntuitionBase);
-
- IntuitionBase = NULL;
-
- SysBase = NULL;
- }
- }
-